
const { createWebAPIRequest } = require('../../util/util')

module.exports = [
  {
    /**
    * @api {get} /music/song/detail [获取音乐详情]
    * @apiGroup Music
    * @apiPermission none
    * @apiParam {Number} ids  ids
    */
    url: '/music/song/detail',
    request: (req, res) => {
      const cookie = req.get('Cookie') ? req.get('Cookie') : ''
      const id = parseInt(req.query.ids)
      const data = {
        // "id": id,
        c: JSON.stringify([{ id: id }]),
        ids: '[' + id + ']',
        csrf_token: ''
      }
      createWebAPIRequest(
        'music.163.com',
        '/weapi/v3/song/detail',
        'POST',
        data,
        cookie,
        musicReq => {
          res.send(musicReq)
        },
        err => res.status(500).send({err})
      )
    }
  }
]
